package cn.nfwx.tv.manager;

import android.content.Context;

import cn.nfwx.tv.callback.ResponseListener;
import cn.nfwx.tv.callback.ResponseWithFailListener;
import cn.nfwx.tv.conts.Constants;
import cn.nfwx.tv.okhttp.CustomOkHttpClient;
import cn.nfwx.tv.okhttp.UrlHelper;

/**
 * Created by zb.liu on 2017/12/22.
 */

public class UpgradeManager {
    private static String update_url = Constants.test_url + "/nfwx-app/v1/update/F6DDD8248BBC4B889D286F5C6A53069E";

    public static void updateVersion(Context context, int version, ResponseListener callBack) {
        CustomOkHttpClient.getObjectRequest(context, update_url + "?ver=" + version, "updateVersion", callBack);
    }

    public static String getUpdate_url(int version) {
        return update_url + "?ver=" + version;
    }

    /**
     * 更新信息
     *
     * @param context
     * @param responseCallback
     * @return
     */
    public static String requestIjkUpdate(Context context, ResponseWithFailListener responseCallback) {
        String request_tag = "requestIjkUpdate";
        CustomOkHttpClient.cancleAll(request_tag);
        String url = UrlHelper.getIjkUpdateUrl();
        CustomOkHttpClient.getObjectRequest(context, url, request_tag, responseCallback);
        return request_tag;
    }
}
